<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
        <h1>Complaints</h1>
        <table class="default">
            <tr>
                <th>Name</th>
                <th>Match</th>
                <th>Detail</th>
                <c:if test='<%= (Boolean.parseBoolean(session.getAttribute("isAdmin").toString()))%>' >
                    <th>Remove</th>
                </c:if>
            </tr>
            <c:forEach  items="${complaints}" var="complaint">
                <tr>
                    <td><a href="<c:url value="/admin/complaint/detail?id=${complaint.id}" />"><c:out value="${complaint.name}"/></a></td>
                    <td>
                        <c:out value="${complaint.match.player1.lastName}"/> vs. <c:out value="${complaint.match.player2.lastName}"/> (<c:out value="${complaint.match.dateAndTime}"/>)
                    </td>

                    <td><a href="<c:url value="/admin/complaint/detail?id=${complaint.id}" />"><img src="<c:url value="/resources/img/detail-icon.png" />" width="16" height="16" alt="detail" /></a></td>
                    <c:if test='<%= (Boolean.parseBoolean(session.getAttribute("isAdmin").toString()))%>' >
                        <td><a href="<c:url value="/admin/complaint/remove?id=${complaint.id}" />" ><img src="<c:url value="/resources/img/remove-icon.gif" />" width="16" height="16" alt="remove" /></a></td>
                    </c:if>
                </tr>
            </c:forEach>

        </table>
    </body>
</html>
